(set: $hp to 10)
(set: $max_health to 10)
(set: $coins to 0)
(set: $days to 0)
(set: $big_sword to (datamap: "id", "big sword", "cost", 50, "damage", 6, "next", 0))
(set: $small_sword to (datamap: "id", "small sword", "cost", 30, "damage", 4, "next", $big_sword))
(set: $dagger to (datamap: "id", "dagger", "cost", 10, "damage", 2, "next", $small_sword))
(set: $fist to (datamap: "id", "fist", "cost", 0, "damage", 1, "next", $dagger))
(set: $hardened_leather to (datamap: "id", "hardened leather", "cost", 45, "armor", 25, "next", 0))
(set: $leather_armor to (datamap: "id", "leather armor", "cost", 20, "armor", 15, "next", $hardened_leather))
(set: $reinforced_cloth to (datamap: "id", "reinforced cloth", "cost", 10, "armor", 5, "next", $leather_armor))
(set: $cloth to (datamap: "id", "cloth", "cost", 0, "armor", 0, "next", $reinforced_cloth))
(set: $weapon = $fist)
(set: $armor = $cloth)
(display: "main")You've been adventuring for $days days. You have $coins coins an your health is $hp.
[[rest]]
[[adventure->start adventure]]
[[shop]]
[[start over->init]] (set: $hp to $max_health + $armor's armor) (set: $days to $days + 1)
You feel refreshed.
(display: "main")A monster appears! (set: $monster_hp to 3)
[[fight]]
[[flee ->main]]Your current weapon is a (print: $weapon's id), damage is (print: $weapon's damage). Your current armor is (print: $armor's id), it's armor value is (print: $armor's armor).
You have $coins coins
(set: $next_weapon to $weapon's next)
(if: not ($next_weapon is 0))[
(set: $nwn to $next_weapon's id)
[[buy $nwn->buy weapon]] ((print: $next_weapon's cost) coins, does (print: $next_weapon's damage) damage)]
(set: $next_armor to $armor's next)
(if: not ($next_armor is 0))[
(set: $nan to $next_armor's id)
[[buy $nan->buy armor]] ((print: $next_armor's cost) coins, gives (print: $next_armor's armor) armor)]
<!-- (if: ($weapon's id) is "fist")[ [[buy dagger]] (10 coins, does 2 damage) ]
(if: ($weapon's id) is "dagger")[ [[buy small sword]] (30 coins, does 3 damage) ]
(if: ($weapon's id) is "small sword") [ [[buy big sword]] (50 coins, does 5 damage) ]
-->
[[Go back to home|main]] (if: (either: 0, 1) is 0) [ The monster bites you!
(set: $hp to $hp - (either: 1,2,3))
(if: $hp < 1) [You are [[dead]]! ]
(else:) [ Your health is $hp.
[[fight]]
[[flee|main]] ]
]
(else:) [ You hit the monster!
(set: $monster_hp = $monster_hp - ($weapon's "damage"))
(if: $monster_hp < 1) [The [[monster is dead]]! ]
(else:) [
Its health is $monster_hp.
[[fight]]
[[flee|main]] ]
]You are dead! [[restart?|init]](set: $streak to $streak + 1)
(set: $drop to (random: 3,10) * $streak)
(set: $spoils to $spoils + $drop)
You collect $drop coins from the monster carcass! Your spoils are currently $spoils coins and your health is $hp. You've killed $streak monster(if: not($streak is 1))[s] on this adventure.
[[conintue|adventure]]
[[go home|collect spoils]](set: $spoils to 0) (set: $streak to 0)
(display: "adventure")(set: $coins to $coins + $spoils)
(display: "main")(if: $coins > ($next_weapon's cost))[(set: $weapon to $next_weapon) (set: $coins to $coins - ($weapon's cost)) (display: "shop")]
(else:)[You don't have enough money!
(display: "shop")](if: $coins > ($next_armor's cost))[(set: $armor to $next_armor) (set: $coins to $coins - ($armor's cost))
(set: $max_health to it + ($armor's armor))
(display: "shop")]
(else:)[You don't have enough money!
(display: "shop")]